package com.xxx;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
//@EnableEurekaClient 可以省略，现在的版本配置了Eureka注册中心，默认就会开启该注解
@SpringBootApplication
public class ServiceConsumerApplication {
    @Bean
    @LoadBalanced//第三种方法要开启该注解，其他两个不开启
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
    public static void main(String[] args) {
        SpringApplication.run(ServiceConsumerApplication.class);
    }
}
